﻿/* ------------------------------------------------------------------------- */
/*
 * C O M P A N Y   P R O P R I E T A R Y
 * use or disclosure of data contained in this file is subject to the
 * requirements an the end of this file
 *
 * CLASSIFICATION: OFFEN / UNCLASSIFIED
 */
/* ------------------------------------------------------------------------- */

/* ######################################################################### */
/** \file M44_ObjectIdentification.cs
 * \brief	This file contains the ObjectIdentification function that 
 *  
 * This file contains the ObjectIdentification function that 
 * 
 *
 * PROJEKT:   NETWORKED MULTI-ROBOT SYSTEMS
 *
 * Copyright (c) 2008 SENER - Universidad Politécnica de Madrid.
 *
 * \author    Gonzalo Rodriguez \n
 *            Universidad Politécnica de Madrid \n
 *            Grupo de Robótica y Cibernética \n
 * \version   0.01
 * \date      2010-03-17
 *
 * \n \n
 * Versionshistory: \n
 * -----------------
 * - Version 0.01:   Gonzalo RODRIGUEZ                         2010-03-17 \n
 *      First implementation of the M44_CompareReconstr.
 *      

 *      
/* ######################################################################### */
using System;
/*This is for using lists*/
using System.Collections;
using System.Collections.Generic;
using System.Text;
/*Using Interfaces classes*/
using Interfaces;
using Interfaces.Basis;
using Interfaces.Complex;
/*Using the C Sharp Matrix Library*/
using NMRS.CSML;
/*Using the 3D rendering engine modules*/
using xna = Microsoft.Xna.Framework;


/* ------------------------------------------------------------------------- */
/**	\namespace NMRS.M44_SensorFusionAndMapping
 *
 *  \brief	This is the namespace of the M44 Sensor Fusion and Mapping module
 */
/* ------------------------------------------------------------------------- */
namespace NMRS.M44_SensorFusionAndMapping
{
    /* ------------------------------------------------------------------------- */
    /**	\class M44_CompareLaserMeasurement
     * 
     *  \brief  This is the class of the M44_CompareLaserMeasurement function.
     * 
     * 
     */
    /* ------------------------------------------------------------------------- */
    public static class M44_CompareLaserMeasurement
    {
        /* ------------------------------------------------------------------------- */
        /**	\fn public static void CompareReconst(M44_auxSlamStr.cl_auxMapCell LocalMapCell, 
                                        M44_auxSlamStr.cl_auxMapCell LocalMapCell_ant,
                                        short n_matrix, short m_matrix)
         * 
         *  \brief 
         *  
         *  \param[in] M44_auxSlamStr.cl_auxMapCell LocalMapCell
         *  \param[in] M44_auxSlamStr.cl_auxMapCell LocalMapCell_ant
         *  
         *  \param[out] bool[,] MovementMap   Matrix indicating where in the map has been movement 
         *
         */
        /* ------------------------------------------------------------------------- */
        public static bool CompareLaser(cl_3DLrfMeasure L1, cl_3DLrfMeasure L2)
                                        
        {
            bool isEqual = true;
            if (L1.s_i == L2.s_i && L1.s_n == L2.s_n)
            {
                for (int i = 0; i < L1.s_i; i++)
                {
                    for (int j = 0; j < L1.s_n; j++)
                    {
                        if (Math.Abs(L1.tf_3DLrfDistance[i, j] - L2.tf_3DLrfDistance[i, j])>0.00008)
                        { isEqual = false; break; }
                    }
                    if (!isEqual)
                        break;
                }
            }
            else
            {
                isEqual = false;
            }

            return isEqual;
        }
    }
}